public class IsRectangleLegal extends Sudoku{
	
	
	
	// Is every number 1-9 in the given rectangle 0..1 times?
    public static boolean isRectangleLegal(int[][] board, int x1, int x2, int y1, int y2, String errormsg) {
	boolean[] isPresent = {false, false, false, false, false, false, false, false, false, false};
 
	for (int x=x1; x<=x2; x++) {
	    for (int y=y1; y<=y2; y++) {
		if (board[x][y] > 0) {
		    if (isPresent[board[x][y]]) {
//			System.out.println(errormsg + ": multiple " + board[x][y] + "s");
			return false;
		    }
		    isPresent[board[x][y]] = true;
		}
	    }
	}
	return true;
    }
    }